<!--
 * @Description: 介绍人信息
 * @Autor: 刘诗文
 * @Date: 2020-12-04 17:16:14
 * @LastEditors: 刘诗文
 * @LastEditTime: 2020-12-07 10:25:26
-->
<template>
  <div>
    <FormPanel ref="formPanel" :list="formList" :cols="3" :labelWidth="130" :formType="type" :isSubmitBtn="false" />
    <BaseDialog :visible.sync="actions.visible" :title="actions.title" width="300" destroyOnClose :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
      <searchIntroducer :resData="this.resData" @close="closeModel" />
    </BaseDialog>
    <ButtonArea :containerStyle="{ display: 'flex', justifyContent: 'center' }">
      <AjaxButton type="primary" :click="saveHandle">确 定</AjaxButton>
      <el-button type="primary" @click="cancelHandle">取 消</el-button>
    </ButtonArea>
  </div>
</template>
<script>
import { dictionary } from '@/utils/dictMixin';
import searchIntroducer from './searchIntroducer.vue';
export default {
  name: 'customerIntroducerInfo',
  components: {
    searchIntroducer
  },
  mixins: [dictionary],
  props: {
    type: {
      type: String
    },
    formData: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    this.selectedData = null;
    this.resData = {};
    return {
      formList: this.createFromList(),
      actions: { type: '', visible: false, title: '' }
    };
  },
  mounted() {},
  methods: {
    createFromList() {
      return [
        {
          type: 'BREAK_SPACE',
          label: '介绍人信息'
        },
        {
          type: 'INPUT',
          label: '介绍人姓名',
          fieldName: 'a1',
          initialValue: '',
          readonly: true,
          unitRender: () => {
            return <el-button slot="append" icon="el-icon-search" onClick={() => this.openModel('search', {})}></el-button>;
          }
        },
        {
          type: 'INPUT',
          label: '介绍人电话',
          fieldName: 'a2',
          disabled: true,
          initialValue: ''
        },
        {
          type: 'INPUT',
          label: '介绍人性质',
          fieldName: 'a3',
          disabled: true,
          initialValue: ''
        },
        {
          type: 'INPUT',
          label: '介绍人车牌号',
          fieldName: 'a4',
          disabled: true,
          initialValue: ''
        },
        {
          type: 'INPUT',
          label: '介绍人车辆VIN',
          fieldName: 'a5',
          disabled: true,
          initialValue: ''
        }
      ];
    },
    async saveHandle() {},
    cancelHandle() {},
    // 打开介绍人查询界面
    openModel(type, val) {
      if (type === 'search') {
        this.actions = { visible: true, type: 'search', title: '介绍人查询' };
      }
    },
    closeModel() {
      this.actions = { visible: false, type: 'search', title: '介绍人查询' };
    }
  }
};
</script>
<style lang="less" scoped></style>
